package com.yupi.yuoj.judge.codesandbox.impl;

import com.yupi.yuoj.judge.codesandbox.CodeSandbox;
import com.yupi.yuoj.judge.codesandbox.model.ExecuteCodeRequest;
import com.yupi.yuoj.judge.codesandbox.model.ExecuteCodeResponse;
import com.yupi.yuoj.judge.codesandbox.model.JudgeInfo;
import com.yupi.yuoj.model.enums.JudgeInfoMessageEnum;


/**
 * 示例代码沙箱
 * 这一层相当于一个实现层，用于样例测试
 */
public class ExampleCodeSandbox implements CodeSandbox {


    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest executeCodeRequest) {
        ExecuteCodeResponse executeCodeResponse = new ExecuteCodeResponse();

        //   todo 代码沙箱接口函数待完善

        {
            JudgeInfo judgeInfo = new JudgeInfo();
            judgeInfo.setMemory(1000L);
            judgeInfo.setTime(1000L);
            judgeInfo.setMessage("测试成功");
            executeCodeResponse.setJudgeInfo(judgeInfo);
            executeCodeResponse.setOutputList(executeCodeRequest.getInputList());
            executeCodeResponse.setStatus(JudgeInfoMessageEnum.ACCEPTED.getValue());
        }


        return executeCodeResponse;
    }
}
